user = {"username":"admin","password":"admin123"}

student = {"name":"xiaoming","age":"12","sex":"nan","score":"98"}
# 增
user["status"] = "已登录"

# 改
student["age"] = "20"

# 删除
del student["sex"]
username = user.pop("username")
user.clear()
print(user,student,username)

# 查询
print(student["name"])
print(student.get("name"))
print(student.get("qwe"))

# 键值对
print(student.keys())
print(student.values())
print(student.items())

# 长度
print(len(student))

# 循环遍历
for key in student:
    print(key,student[key])
for key in student.keys():
    print(key)
for val in student.values():
    print(val)
for k,v in student.items():
    print(k,v)

# 统计字符串中每个字符出现的次数
str1 = "helloworld"
result = {}
for k in str1:
    result[k] = str1.count(k)
print(result)